<?php session_start();
	include("../../Funciones/Conexion.php");

$con = Conexion();
$q=strtolower($_GET["q"]);
$t=$_SESSION['t'];
$result="";
$inserta="";
 

if ($t=='a'){
	$inserta="select nom_cooperativa from tblcooperativa order by nom_cooperativa asc";
	$result=pg_query($con,$inserta);
}
if ($t=='b'){
	$inserta="select nom_grupo_precoop from tbldatos_grupo_precoop order by nom_grupo_precoop asc";
	$result=pg_query($con,$inserta);
}
/*else
{
	$nom="nom_persona";
	$tab="tblpersona";
}*/

	if(!$result){
		echo pg_last_error();
		//exit();
	}
	while ($items = pg_fetch_row($result)){
       foreach($items  as $clave){
	   if (strpos(strtolower($clave), $q) !== false) {
		echo $clave."\n";
	}
 }
}

?>